0

I'm using the below code to launch Waze maps. Now my app want to get a callback whenever the Waze map has been loaded? Is there any direct call backs available? I googled but no luck. Any hack or any way can I achieve this?

String url = "waze://?q="+destination+ "&navigate=yes";
Intent intentWaze = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intentWaze.setPackage("com.waze");
mContext.startActivity(intentWaze);

Any Links or code will be helpful. Thanks in Advance.

Manju
  • 720
  • 9
  • 23

1 Answers1

0

There is no available broadcast recievers to know whether waze has been loaded or not,

You can use only use resolveActivity method to know wheter waze intent is available or not:

PackageManager packageManager = getActivity().getPackageManager();
if (intentWaze.resolveActivity(packageManager) != null) {
    startActivity(intentWaze);
} else {
   // No Intent available to handle action
}
Saeed Masoumi
  • 8,746
  • 7
  • 57
  • 76
  • Hi Saeed thanks for your quick reply. I'm expecting not just start of the waze activity, something from waze like onMapsLoaded once the location has been set. sorry if my question was not clear – Manju Oct 01 '19 at 08:56
  • @Manju You mean you want to get a callback in your app whenever the Waze map has been loaded? – Saeed Masoumi Oct 01 '19 at 09:03
  • Yes that is what exactly I want. – Manju Oct 01 '19 at 10:20
  • you mean to say we cant achieve this. Is there any hack like thing listening to some notifications like https://stackoverflow.com/questions/24511169/detecting-the-end-of-navigation-in-waze-or-google-maps-for-mobile. But this is for end of route – Manju Oct 01 '19 at 10:33
  • @Manju no, you can't – Saeed Masoumi Oct 01 '19 at 13:05