0

I am trying to understand Android's Intent command.

In the code I have received (and which does not work) I have the following:

Intent intent = new Intent("com.abc.wxyz.all");
intent.setPackage("com.smartdevice.wxyz");  // <--- Code Crashes Here
bindService(intent, mServiceConn, Context.BIND_AUTO_CREATE);  

In my app\src\java directory I have sub-directories: com\smartdevice\wxyztest
And the code's package name is: com.smartdevice.wxyztest
But I don't have either of the 2 'com' directories listed in the code above.

Is the code crashing because I am supposed to have directories and code in those 2 'com' directories, or what?
The reason I ask is my lack of understanding as to what the Intent command is supposed to do in an Android app.

Thanks

Dhugalmac
  • 554
  • 10
  • 20
  • If it crashes, show the stack trace. As for your general question, see here: https://stackoverflow.com/questions/6578051/what-is-an-intent-in-android – Daniel Nugent Jun 20 '18 at 17:39
  • Intent.setPackage(); is used to specify app to handle the event or limit the apps that gets the intent. You said your app package name is "com.smartdevice.wxyztest". Is there another app with package "com.smartdevice.wxyz" you specified in your code? – SafalFrom2050 Jun 20 '18 at 17:47
  • On the Android device, I do not know of any other apps/packages which have either of those designations and no other app packages are shown in the Android App Manager. – Dhugalmac Jun 20 '18 at 18:06
  • Please share crash log – Godfather Jun 20 '18 at 18:16
  • Apparently the code isn't really Crashing. Instead it seems to still be running, but going somewhere "into the ether" and being not responsive at all. Therefore no Logcat error results. – Dhugalmac Jun 20 '18 at 19:07

0 Answers0