當用戶在安裝我的應用程序後第一次登錄時發生此錯誤。但在下次發佈時(用戶已經登錄)該應用程序正常工作。java.lang.SecurityException:無法在註冊接收者時找到調用者android.app.ApplicationThreadProxy的應用程序android.content.IIntentReceiver
在我的應用程序中,我使用BroadcastReceiver
這是用於檢查互聯網連接。
因此,具體來說,該應用程序在註冊BroadcastReceiver
的同時具有上述Exception
。任何幫助將非常明顯!
我logcat的是像下面
java.lang.RuntimeException: Unable to resume activity {com.android.myproject/com.android.myproject.MapActivity}: java.lang.SecurityException: Unable to find app for caller [email protected] (pid=24211) when registering receiver [email protected]
1 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2762)
2 at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2791)
3 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1288)
4 at android.os.Handler.dispatchMessage(Handler.java:99)
5 at android.os.Looper.loop(Looper.java:137)
6 at android.app.ActivityThread.main(ActivityThread.java:5095)
7 at java.lang.reflect.Method.invokeNative(Native Method)
8 at java.lang.reflect.Method.invoke(Method.java:511)
9 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:845)
10 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
11 at dalvik.system.NativeStart.main(Native Method)
12Caused by: java.lang.SecurityException: Unable to find app for caller [email protected] (pid=24211) when registering receiver [email protected]
13 at android.os.Parcel.readException(Parcel.java:1425)
14 at android.os.Parcel.readException(Parcel.java:1379)
15 at android.app.ActivityManagerProxy.registerReceiver(ActivityManagerNative.java:2228)
16 at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1356)
17 at android.app.ContextImpl.registerReceiver(ContextImpl.java:1324)
18 at android.app.ContextImpl.registerReceiver(ContextImpl.java:1318)
19 at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:423)
20 at com.android.myproject.MapActivity.onResumeOperations(MapActivity.java:584)
21 at com.android.myproject.MapActivity.onResume(MapActivity.java:618)
22 at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185)
23 at android.app.Activity.performResume(Activity.java:5203)
24 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2752)
爲了澄清我的問題,我的onResumeOperations()
樣子
public void onResumeOperations(){
if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)&& !isFinishing()) {
ShowGpsDialog();
} else {
removeGpsDialog();
}
registerReceiver(internetConnectionReciever, new IntentFilter(
"android.net.conn.CONNECTIVITY_CHANGE"));
registerReceiver(GpsChangeReceiver, new IntentFilter(
LocationManager.PROVIDERS_CHANGED_ACTION));
isRecieverRegistered = true;
if (AndyUtils.isNetworkAvailable(this)
&& manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
if (!isDataRecieved) {
checkStatus();
startLocationUpdateService();
// getPreReservations();
}
}
registerIsApproved();
startRepeatingChecker();
}
這onResumeOperations()
被稱爲onResume()
。正如我之前提到的,註冊internetConnectionReceiver
時會出現問題。
可以共享logcat嗎? – rafsanahmad007
請查看我編輯的問題 –
您可以發佈您的'MapActivity.java:618'以及其他一些相關的代碼嗎? –