DJI-Mobile-SDK-Tutorials / Android-FPVDemo

This demo shows how to create a simple FPV view and how to take photo and record video using DJI Mobile SDK.
MIT License
62 stars 81 forks source link

Cannot run FPVDemo #20

Closed merlinthewizz closed 6 years ago

merlinthewizz commented 7 years ago

Hi, I am new to Android Studio and Github. I tried to build the Camera Application of the DJI SDK 4.1.1 by using Android Studio 1.5 then with Android Studio 2.2, both without success.

First I wanted to confirm that my android device is compatible with the Phantom 4 Pro. I downloaded the DJI Go 4 application and started it, input my email and password used in my dji account. It works fine with the Phantom 4 Pro with the following devices: Zenpad 8.0 (Android 6.0.1) tablet, Galaxy Note 10.1 (2014 edition) running Android 4.4.2. The PH4P is detected once the RC is turned on then I can enter the camera view and the video streaming starts once I turn the PH4P ON.

However, it didn't work on Galaxy S6 Edge (Android 7.0).

Using the Zenpad 8.0, I tried the 2 following methods:

Method 1: By downloading the project from Github at: https://github.com/DJI-Mobile-SDK-Tutorials/Android-FPVDemo I signed in and clicked "Clone or download" button, then "Download Zip". I unzipped the archive and imported it in Android Studio. 2 messages appeared:

What am I missing here ?

Method 2 By following step by step the FPVDemo tutorial available at: https://developer.dji.com/mobile-sdk/documentation/android-tutorials/index.html

I requested a DJI Key and inserted it in the manifest.xml file.

When I compile the application from android, the connection activity starts on my tablet. Then I unplug the tablet from the PC and while the remote controller is OFF I connect the tablet to the remote controller, and turn the RC power ON. I select the FPVDemo to access the USB. There is a "Register Success" toast message showing up, but nothing happens and the connection activity is not displayed.

From the previous SDK, I checked the following points:

I could track the issue to DJISDKManager.getInstance().startConnectionToProduct(); in FPVDemoApplication.java returning false, but I couldn't get further information regarding the cause.

Thanks for your help!

oliverou commented 7 years ago

Hi @merlinthewizz, please check my feedbacks below:

  1. Method 1, please import the FPVDemo folder in Android Studio instead of the entire Android-FPVDemo folder you download from Github.

  2. Method 2,when you see "Register Success" toast message shows up, do you open FPVDemo app on your Android device manually? Please don't wait for it to open automatically. Then you may see the connection activity view, you can follow the gif animation at the bottom of the FPVDemo tutorial to play the app.

I have tested it on DJI Phantom 4 Pro, it works well:

screenshot_20170616-033606 screenshot_20170616-033618

merlinthewizz commented 7 years ago

Thanks for the quick answer! Until now (with DJI SDK 2.4 and PH3P), I used to: . turn OFF the RC . connect the RC to the android device (app not started) by turning the RC ON, there is "Choose an app for the USB device" popup, and by selecting the application it will start automatically.

I imported the project to android studio and could run it, thanks!

Now the only way to run the FPVDemo application is: . manually start the FPVDemo app on the android device by clicking its icon . turn the RC ON . select the FPVDemo app when the "Choose an app for the USB device" popup appears . turn the PH4P ON

Is it the right way to start the application? (The DJI Go 4 App still can be started automatically by selecting that app in the "Choose an app for the USB device" popup)

Thanks!

oliverou commented 6 years ago

@merlinthewizz , it's not necessary to keep the order of turning on the RC and then the P4P, the point is you should make sure you enter the App Key in the AndroidManifest.xml file and connect to internet when the application starts. If it registers successfully, and agree with the permission requests, you should be able to play with the demo without issues.

BTW, application starts automatically depends on how you configure the AndroidManifest.xml file. Since this issue is resolved, close it now.

lining301 commented 6 years ago

I find that it's necessary to keep the order of turning on app and P4P. First, turn on the app, regitster success, then turn on the P4P. Some others find this?