我想提一下,这是复制副本的副本,我从来没有得到任何答案。我已经有这个问题超过2个月了,同时我不得不继续这个项目而忽略了问题但是,如果不解决这个问题,我就无法继续前进。
所以,我有一个UDP连接,如下所示:
final Runnable r = new Runnable() {
public void run() {
try {
if(host != null){
byte [] data = "lista_categorii".getBytes();
byte[] buf = new byte[1024];
host = InetAddress.getByName(//IPGOESHERE;
socket = new DatagramSocket(55901);
DatagramPacket packet = new DatagramPacket(data, data.length, host, 55901);
socket.send(packet);
socket.setSoTimeout(1000);
/*
packet = new DatagramPacket(buf, buf.length);
socket.receive(packet);
//String modifiedSentence = new String(packet.getData());
modifiedSentence = new String(packet.getData(), 0, packet.getLength());*/
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
if(socket != null){
socket.close();
}
}
}
};
一切正常,直到我按下调用我刚刚链接的代码的按钮。一旦我这样做,我得到了这个地狱产生的错误:
07-04 15:11:44.199: E/DatabaseUtils(2344): Writing exception to parcel
07-04 15:11:44.199: E/DatabaseUtils(2344): java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
07-04 15:11:44.199: E/DatabaseUtils(2344): at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140)
07-04 15:11:44.199: E/DatabaseUtils(2344): at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
07-04 15:11:44.199: E/DatabaseUtils(2344): at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607)
07-04 15:11:44.199: E/DatabaseUtils(2344): at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
07-04 15:11:44.199: E/DatabaseUtils(2344): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
07-04 15:11:44.199: E/DatabaseUtils(2344): at android.os.Binder.execTransact(Binder.java:388)
07-04 15:11:44.199: E/DatabaseUtils(2344): at dalvik.system.NativeStart.run(Native Method)
我的Android Manifest看起来像这样(我相信人们会这么问......):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.applicatierestaurant"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="INTERACT_ACROSS_USERS_FULL" />
<uses-permission android:name="INTERACT_ACROSS_USERS" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name="com.restaurant.main.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.restaurant.main.Categories" >
</activity>
<activity android:name="com.restaurant.main.Produse" >
</activity>
<activity android:name="com.restaurant.main.ScreenComanda" >
</activity>
<activity android:name="com.restaurant.main.OfertaZilei" >
</activity>
<activity android:name="com.restaurant.main.CeAmComandat" >
</activity>
</application>
</manifest>
如果需要任何其他信息,请告诉我,我会马上和你在一起。
注意:我在三星Galaxy S3上测试它。