Coder Social home page Coder Social logo

mobile-uxsdk-beta-android's People

Contributors

accek avatar alainpimentel avatar dji-dev avatar dji-william avatar hoker- avatar hoker1 avatar huhuanhuan avatar kenargo avatar kpn-dji avatar michael-dji avatar oliverou avatar siddutgikar avatar skycatchci avatar snmillar avatar talobin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobile-uxsdk-beta-android's Issues

MapBox SDK is VERY OLD (9.2.0 vs 10.3.0)

MapBox has release many security and performance updates over the years that the UI/UX SDK has been implemented and it appears that the current release has never been updated to integrate any of these changes. Unfortunately, it isn't possible for the community to update the beta public domain code because a required body of code appears to be missing from the source tree (com.dji.mapkit.core.providers) and without this code it is not possible to initMapbox as the code has changed between the versions.

Any plans to either update the MapBox SDK or provide those classes? Ideally the later as it would allow the community to grow the SDK.

请问下精灵4 RTK 如何启用?

是否有相关教程以及示例,目前通过如下方法设置 RTK:

Aircraft aircraft = (Aircraft) DJISDKManager.getInstance().getProduct();
        if (aircraft != null) {
            FlightController flightController = aircraft.getFlightController();
            RTK rtk = flightController.getRTK();
            // 检查设备是否支持 RTK
            boolean rtkSupported = flightController.isRTKSupported();
            if (rtkSupported) {
                // 启用 RTK 模块
                Objects.requireNonNull(rtk).setRtkEnabled(true, new CommonCallbacks.CompletionCallback() {
                    @Override
                    public void onResult(DJIError djiError) {
                        showToast("启用 RTK 模块: " + djiError);
                    }
                });

                // 判断是否成功开启 RTK
                Objects.requireNonNull(rtk).getRtkEnabled(new CommonCallbacks.CompletionCallbackWith<Boolean>() {
                    @Override
                    public void onSuccess(Boolean aBoolean) {
                        showToast("获取 RTK 状态成功: " + aBoolean);
                    }

                    @Override
                    public void onFailure(DJIError djiError) {
                        showToast("获取 RTK 状态失败: " + djiError);
                    }
                });

            }

            // 设置信号源: 网络 RTK
            Objects.requireNonNull(flightController.getRTK()).setReferenceStationSource(ReferenceStationSource
                    .BASE_STATION, new CommonCallbacks.CompletionCallback() {
                @Override
                public void onResult(DJIError djiError) {
                    showToast("设置信号源为: BASE_STATION: " + djiError);
                }
            });
            flightController.getRTK().addReferenceStationSourceCallback(new ReferenceStationSource.Callback() {
                @Override
                public void onReferenceStationSourceUpdate(ReferenceStationSource referenceStationSource) {
                    showToast("查看当前信号源: " + referenceStationSource.toString());
                }
            });
        }

但是 startMission 的时候总是提示:RTK is not ready,恳请各位大佬指点一二,谢谢!!!

UnitModeListItemWidget causes exception to be thrown

When attempting to change the unit in the UnitModeListItemWidget, this error is thrown, causing the app to crash:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.flyby.pilot, PID: 14394
    java.lang.ClassCastException: java.lang.NullPointerException cannot be cast to dji.ux.beta.core.base.UXSDKError
        at dji.ux.beta.core.panel.listitem.unittype.UnitModeListItemWidget$onOptionTapped$2.accept(UnitModeListItemWidget.kt:171)
        at dji.ux.beta.core.panel.listitem.unittype.UnitModeListItemWidget$onOptionTapped$2.accept(UnitModeListItemWidget.kt:67)
        at dji.thirdparty.io.reactivex.internal.observers.CallbackCompletableObserver.onError(Unknown Source)
        at dji.thirdparty.io.reactivex.internal.observers.CallbackCompletableObserver.onComplete(Unknown Source)
        at dji.thirdparty.io.reactivex.internal.operators.completable.CompletableObserveOn$ObserveOnCompletableObserver.run(Unknown Source)
        at dji.thirdparty.io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(Unknown Source)
        at android.os.Handler.handleCallback(Handler.java:755)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:167)
        at android.app.ActivityThread.main(ActivityThread.java:6240)
        at java.lang.reflect.Method.invoke(Native Method)

Unable add the djiPolyline

DJIPolyline djiPolyline = mapWidget.getMap().addPolyline(new DJIPolylineOptions().addAll(_waypointList)
.color(0xF7BA0B)
.width(100)
.visible(true)
.zIndex(1000));
djiPolyline.setColor(0xF7BA0B);
djiPolyline.setWidth(100);
djiPolyline.setPoints(_waypointList);
djiPolyline.setZIndex(1000);

I worve the code ,but these statements did not respond, and no lines appeared on the map.
Could you tell me what caused it?

Refactoring all Java classes to Kotlin

Hello @dji-dev @DJI-William !

We're using this UX-SDK and we have cloned the repository due to introducing some things specific to our needs. We've also refactored/moved some classes from Java to Kotlin due to less overhead when using some features such as sealed classes. We're now fetching your changes upstream and trying to incorporate them in our cloned repo. But it would be much easier if all classes in Java would also be converted to Kotlin in this repository. During our conversion, we did not notice any issues by doing simple conversion from Java to Kotlin class. Is there something we can help to make this repository use only Kotlin? For example, would you accept a PR that would contain the complete conversion?

Enterprise accessories

Is there any widget that can be used as Mavic 2 Enterprise Speaker Panel?
Android UX SDK Speaker Panel is so bad.

关于控件初始化的问题

针对m300:
现在许多控件 比如fpv 会出现 没有连接上无人机 直接进入会发现图传没有 基本上只有无人机连接成功以后 才会一切正常
电池的bug:m300 拿走右边的电池 会显示电量为0 并且这个时候剩余寿命也是为0
地图的bug: 第一次无人机的图标会出现 第二次就没有 重新进入的时候
m300图传比列;基本上都是全屏显示 不管什么相机 并且fpv 应该是4:3 但是目前都是全屏 切换比列基本上没用

Removing markers or polylines from map (DJIMap)

Is there really no way to remove markers or polylines from the map? Or am I missing something...?

Only way I can see to remove markers is to clear() the map, but this is not ideal as it makes the aircraft and fly zones disappear, too.

A DJI Menbership is need for apply UXSDK Key ?

If I want to use DJI UXSDK in my Android Project, I need a DJI Key, for UXSDK, is a menber ship necessary if I want to apply a key ? Now I just can apply key for mobile SDK.Can I use mobile SDK's key in a UX SDK project ?

Caused by: com.android.builder.errors.EvalIssueException

I've git cloned and on the first run for the "android-uxsdk-beta-sample" I got the following error!

Caused by: com.android.builder.errors.EvalIssueException: SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/ghaith/StudioProjects/Mobile-UXSDK-Beta-Android/local.properties'.

I am on macOS Monterey version 12.3.1
And Android Studio Chipmunk 2021.2.1

I'm sure that the problem is not from the SDK location since it is the same in different projects!

Battery widget not scaling text size properly

When trying to use a text size in sp for xml attribute uxsdk_singlePercentTextSize or uxsdk_dualPercentTextSize, the font size is much larger than anticipated. It seems to be because DisplayUtil.pxToSp(context, it) is missing in initAttributes() in BatteryWidget.kt when setting the text size.

This behavior is inconsistent with similar widgets like FlightModeWidget

Map Widget waypoint markers

I didn't find any method in UXSDK Beta Map Widget to insert waypoint markers with title, position and rotation parameters on map.
Would be great to have that feature since the DJI Android UXSDK DJIMarkerOptions.title don't work as it should since my last support question in June.

FYI, screenshots from my method trying to display title and the result on mapWidget (using the legacy Android UX SDK).

image

image

image

Centering on aircraft without setMapCenterLock?

Hi, I'm trying to center the MapWidget on the aircraft WITHOUT locking it. After centering, I want to be able to drag the map without it popping back to the aircraft.

This does not work reliably:

public void centerMap() {
   mapWidget.setMapCenterLock(MapWidget.MapCenterLock.AIRCRAFT);
   mapWidget.setMapCenterLock(MapWidget.MapCenterLock.NONE);
}

Is there a way to do this? It seems like this should be a simple thing to implement if it's not already.

录像中格式化奔溃

使用格式化方式来自于控件SystemStatusListPanelWidget里的格式化按钮

   Not supported(255)
        at dji.ux.beta.core.base.DJISDKModel$3.onFailure(DJISDKModel.java:212)
        at dji.keysdk.KeyManager$3.onFails(Unknown Source:6)
        at dji.sdksharedlib.hardware.abstractions.gfd.run(Unknown Source:8)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7073)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

zoom slider widget

There is no zoom slider widget similar to pilot app in this sdk, How to design it?

Add support for Mini 3 Pro

It seems that Mini 3 Pro is not supported.
It is detected as "unknown aircraft" and doesn't show any data from it.
Please add.

Map Widget使用google地图时,坐标有偏移

当坐标定位在美国时,Google map上显示的marker和真实坐标不匹配

切换到mapbox后,地图上显示的marker位置正确

测试坐标
38.9334361,-77.4063494

任意机型

在Demo里测试***前的国旗的经纬度 39.905592, 116.391314,在Google map上显示位置正确

MissingBackpressureException on version 0.5

I updated our application to use UX beta 0.5.1 from 0.4 and have started occasionally getting exception below which crashes whole app (now while developing on Smart Controller without connecting to drone).

This didn't happen on 0.4. Any idea how to cure the situation, widget backpressure should not kill the whole app.

dji.thirdparty.io.reactivex.exceptions.MissingBackpressureException: Could not deliver value due to lack of requests
        at dji.thirdparty.io.reactivex.processors.BehaviorProcessor$BehaviorSubscription.test()
        at dji.thirdparty.io.reactivex.processors.BehaviorProcessor$BehaviorSubscription.emitNext()
        at dji.thirdparty.io.reactivex.processors.BehaviorProcessor.onNext()
        at dji.ux.beta.core.util.DataProcessor.onNext(DataProcessor.java:64)
        at dji.ux.beta.core.widget.compass.CompassWidgetModel.updateStates(CompassWidgetModel.kt:188)
        at dji.ux.beta.core.widget.compass.CompassWidgetModel.onSensorChanged(CompassWidgetModel.kt:240)
        at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent(SystemSensorManager.java:699)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:323)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:6240)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1000)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:868)

VideoFeedUpdate hook not working

Hello!

I'm trying to use hooks on FPVWidgetState, specifically data class VideoFeedUpdate(val videoBuffer: ByteArray?, val size: Int) : FPVWidgetState() to get video frame each time it's updated. I'm using the following example in Java to subscribe to updates:

fpvWidget.getWidgetStateUpdate()
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(fpvWidgetState -> {
                if (fpvWidgetState instanceof FPVWidget.FPVWidgetState.ProductConnected) {
                    FPVWidget.FPVWidgetState.ProductConnected productConnected = (FPVWidget.FPVWidgetState.ProductConnected) fpvWidgetState;
                    Log.d(TAG, "Product connected: " + productConnected.isConnected());
                }
                if (fpvWidgetState instanceof FPVWidget.FPVWidgetState.VideoFeedUpdate) {
                    FPVWidget.FPVWidgetState.VideoFeedUpdate videoFeedUpdate = (FPVWidget.FPVWidgetState.VideoFeedUpdate) fpvWidgetState;
                    Log.d(TAG, "Feed size: " + videoFeedUpdate.getSize());
                    Log.d(TAG, "Buffer: " + Arrays.toString(videoFeedUpdate.getVideoBuffer()));
                }
            });

Unfortunately I don't see anything in the logs regarding outputted feed size and buffer. I've also tried ProductConnected state and that actually works fine, I can see the output in the log. Do I have to set up something else on the codecmanager or FPVWidget level to get the back the update for the video feed?

ClassNotFoundException: Didn't find class "dji.log.DJILog"

I have created custom UXKeys, When I run with proguard, It crashes when calling UXKeys.addNewKeyClass(CustomKeys::class.java)
My code in application:

override fun onCreate() {
        super.onCreate()
        GlobalPreferencesManager.initialize(AppGlobalPreferences(this))
        UXKeys.addNewKeyClass(CustomKeys::class.java)
  }

I set up multiDexEnabled,
My version:

implementation ('com.dji:dji-sdk:4.16.1')
compileOnly ('com.dji:dji-sdk-provided:4.16.1')
implementation 'com.github.dji-sdk:Mobile-UXSDK-Beta-Android:v0.5.1'

My log error:
Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Ldji/log/DJILog; at dji.ux.beta.core.communication.UXKeys.initializeKeyValueTypes(UXKeys.java:67) at dji.ux.beta.core.communication.UXKeys.addNewKeyClass(UXKeys.java:79) at com.abc.djidrone.MyApplication.onCreate(MyApplication.kt:88) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1126) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6097) at android.app.ActivityThread.-wrap1(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1791) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:7000) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

NullPointerException - dji.ux.beta.map.widget.map.FlyZoneHelper.addCircleToMap

Fatal Exception: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1019)
at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1014)
at dji.ux.beta.map.widget.map.FlyZoneHelper.addCircleToMap(FlyZoneHelper.java:632)
at dji.ux.beta.map.widget.map.FlyZoneHelper.drawFlyZone(FlyZoneHelper.java:511)
at dji.ux.beta.map.widget.map.FlyZoneHelper.onFlyZoneListUpdate(FlyZoneHelper.java:204)
at dji.ux.beta.map.widget.map.MapWidget.onFlyZoneListUpdate(MapWidget.java:653)
at dji.ux.beta.map.widget.map.MapWidget.lambda$CC8HqsDVt_Ue_wJysFAlWmsF6h8()
at dji.ux.beta.map.widget.map.-$$Lambda$MapWidget$CC8HqsDVt_Ue_wJysFAlWmsF6h8.accept(:4)
at dji.thirdparty.io.reactivex.internal.observers.ConsumerSingleObserver.onSuccess(:2)
at dji.thirdparty.io.reactivex.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(:14)
at dji.thirdparty.io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Map Widget wiki fix

Hello!

Under Wiki page for Map Widget where it specifies how to add different mapping providers, it says to add it to layout file via key app:mapProvider, but it should actually be under key app:uxsdk_mapProvider. Same holds true for key mapBoxToken, which should be uxsdk_mapBoxToken.

Simulator indicator widget - Attitude data

Hello!

First of all, great job by providing Simulator indicator widget, this really helps with debugging flight controller data without having to go outside to actually fly the drone :).

But I'm having some issue with Attitude data not being updated when calling sendVirtualStickFlightControlData method for controlling the aircraft. Here is an example:

FlightController flightController = djiDroneData.getFlightController();
                flightController.setVirtualStickAdvancedModeEnabled(true);
                flightController.setRollPitchControlMode(RollPitchControlMode.VELOCITY);
                flightController.setRollPitchCoordinateSystem(FlightCoordinateSystem.BODY);
                flightController.setVerticalControlMode(VerticalControlMode.VELOCITY);
                flightController.setYawControlMode(YawControlMode.ANGULAR_VELOCITY);

                djiDroneData.getFlightController().sendVirtualStickFlightControlData(
                        new FlightControlData(
                                mPitch, mRoll, mYaw, mThrottle
                        ), new CommonCallbacks.CompletionCallback() {
                            @Override
                            public void onResult(DJIError djiError) {
                                if (djiError != null) {
                                    Log.e(TAG, djiError.getDescription());
                                } else {
                                    Log.d(TAG, String.format("Attitude: %f %f %f %f", mPitch, mRoll, mYaw, mThrottle));
                                }
                            }
                        }
                );

This piece of code is being executed as a TimerTask with frequency 10HZ, so it should be enough. I have also tested it without Simulator and I can actually fly the drone via virtual joysticks. But for some reason when I have Simulator enabled and when I move the joysticks, I don't see the values under Attitude section changing that much, they are only changing slightly as they should if aircraft is hovering.

TypeCastException in ListItemRadioButtonWidget

val radioButton: RadioButton? = radioGroup.getChildAt(index) as RadioButton

Fatal Exception: kotlin.TypeCastException: null cannot be cast to non-null type android.widget.RadioButton
       at dji.ux.beta.core.base.widget.ListItemRadioButtonWidget.setSelected(ListItemRadioButtonWidget.kt:196)
       at dji.ux.beta.core.listitemwidget.rcstickmode.RCStickModeListItemWidget.updateUI(RCStickModeListItemWidget.kt:121)
       at dji.ux.beta.core.listitemwidget.rcstickmode.RCStickModeListItemWidget.access$updateUI(RCStickModeListItemWidget.kt:50)
       at dji.ux.beta.core.listitemwidget.rcstickmode.RCStickModeListItemWidget$reactToModelChanges$1.accept(RCStickModeListItemWidget.kt:81)
       at dji.ux.beta.core.listitemwidget.rcstickmode.RCStickModeListItemWidget$reactToModelChanges$1.accept(RCStickModeListItemWidget.kt:50)
       at dji.thirdparty.io.reactivex.internal.subscribers.LambdaSubscriber.onNext(:8)
       at dji.thirdparty.io.reactivex.internal.operators.flowable.FlowableObserveOn$ObserveOnSubscriber.runAsync(:68)
       at dji.thirdparty.io.reactivex.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run(:17)
       at dji.thirdparty.io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(:2)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8512)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Android resource linking failed

Hello!

I get the following issue (Android resource linking failed) when trying to build a project that has this library (implementation 'com.github.dji-sdk:Mobile-UXSDK-Beta-Android:v0.3.0'`) defined as dependency:

AAPT: error: resource attr/uxsdk_cameraColorTextAppearance
AAPT: error: resource attr/uxsdk_cameraColorTextColor
AAPT: error: resource attr/uxsdk_cameraColorTextBackground
AAPT: error: resource attr/uxsdk_cameraColorTextSize
AAPT: error: resource attr/uxsdk_titleTextBackground
AAPT: error: resource attr/uxsdk_titleTextBackground

I noticed that exactly the same values are marked with Cannot resolve symbol errors also for this repository if you check it out. Though build completes successfully.

Support for MSDK 5?

Is there any plan to support the Mobile SDK 5.0, released a few month ago ?

Sorry if this has been asked already but I couldn't find the answer anywhere. Tell me if I'm huggely wrong and that the UXSDK already supports the MSDK 5 (and therefore the Mavic 3E for example).

Thanks

如何获取摄像头中的图像帧

想通过获取拍照或者录像得到的图像,通过调用深度学习模型做一些目标检测和识别的工作,请问通过什么方法可以获取

TopBarPanelWidget crashes app on SmartController

Hi, I'm getting the following error whenever I try to use the TopBarPanelWidget.

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.flyby.pilot, PID: 9846
    java.lang.NullPointerException: Attempt to invoke interface method 'boolean dji.ux.beta.core.base.GlobalPreferencesInterface.isAirSenseTermsNeverShown()' on a null object reference
        at dji.ux.beta.core.widget.airsense.AirSenseWidget.showWarningDialog(:282)
        at dji.ux.beta.core.widget.airsense.AirSenseWidget.updateAirSenseWarningLevel(:248)
        at dji.ux.beta.core.widget.airsense.AirSenseWidget.access$updateAirSenseWarningLevel(:91)
        at dji.ux.beta.core.widget.airsense.AirSenseWidget$reactToModelChanges$1.accept(:231)
        at dji.ux.beta.core.widget.airsense.AirSenseWidget$reactToModelChanges$1.accept(:91)
        at dji.thirdparty.io.reactivex.internal.subscribers.LambdaSubscriber.onNext()
        at dji.thirdparty.io.reactivex.internal.operators.flowable.FlowableObserveOn$ObserveOnSubscriber.runAsync()
        at dji.thirdparty.io.reactivex.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run()
        at dji.thirdparty.io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run()
        at android.os.Handler.handleCallback(Handler.java:755)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:167)
        at android.app.ActivityThread.main(ActivityThread.java:6240)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1000)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:868)
E/fdd: runMethod: null

The element is being used in my activity_main.xml as such:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:layout_gravity="center"
    android:layout_centerHorizontal="true"
    tools:context=".MainActivity">

    <dji.ux.beta.core.panelwidget.topbar.TopBarPanelWidget
        android:id="@+id/panel_top_bar"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@color/black"
        app:layout_constraintHeight_percent="0.08"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

     [...]

</androidx.constraintlayout.widget.ConstraintLayout>

Am I doing something incorrectly or is this a bug?

From my build.gradle:

minSdkVersion: 19
targetSdkVersion: 30
implementation 'com.github.dji-sdk:Mobile-UXSDK-Beta-Android:v0.4.0'

Smart Controller running Android version 7.1.2

How to make drone's location in DefualtLayoutActivity's minimap?

As you see the Sample code, there are no functions to make drone's location on map. So I tried to make it by putting some codes of google map tutorials to beta sample code(DefaultLayoutActivity more precisely).
What I added the codes are

private void initFlightController() {

    BaseProduct product = SampleApplication.getProductInstance();
    if (product != null && product.isConnected()) {
        if (product instanceof Aircraft) {
            mFlightController = ((Aircraft) product).getFlightController();
            Log.d(TAG, "mFlightController :"+mFlightController);
            Log.d(TAG, "getAircraftlocaiton :"+mFlightController.getState().getAircraftLocation());



        }
    }

    if (mFlightController != null) {
        mFlightController.setStateCallback(new FlightControllerState.Callback() {

            @Override
            public void onUpdate(FlightControllerState djiFlightControllerCurrentState) {
                droneLocationLat = djiFlightControllerCurrentState.getAircraftLocation().getLatitude();
                droneLocationLng = djiFlightControllerCurrentState.getAircraftLocation().getLongitude();
                Log.d(TAG, "droneLocationLat :"+droneLocationLat+",\""+"droneLocationLng :"+droneLocationLng);
                Log.d(TAG, "getAircraftlocaiton :"+mFlightController.getState().getAircraftLocation());
                updateDroneLocation();
            }
        });
    }
}

private void updateDroneLocation(){

    DJILatLng pos = new DJILatLng(droneLocationLat, droneLocationLng);
    //Create MarkerOptions object
    final DJIMarkerOptions markerOptions = new DJIMarkerOptions();
    markerOptions.position(pos);
    markerOptions.icon(DJIBitmapDescriptorFactory.fromResource(R.drawable.ic_drone));

    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (droneMarker != null) {
                droneMarker.remove();
            }

            if (checkGpsCoordination(droneLocationLat, droneLocationLng)) {
                droneMarker = mapWidget.getMap().addMarker(markerOptions);
            }
        }
    });
}

public static boolean checkGpsCoordination(double latitude, double longitude) {
    return (latitude > -90 && latitude < 90 && longitude > -180 && longitude < 180) && (latitude != 0f && longitude != 0f);
}

and when I press the defaultlayout button with simulator to make drone's location, the app is crushed.
And the main errors say :

  1. java.lang.RuntimeException: Unable to resume activity {com.dji.ux.beta.sample/com.dji.ux.beta.sample.DefaultLayoutActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'com.dji.mapkit.core.models.annotations.DJIMarker com.dji.mapkit.core.maps.DJIMap.addMarker(com.dji.mapkit.core.models.annotations.DJIMarkerOptions)' on a null object reference

  2. Attempt to invoke interface method 'com.dji.mapkit.core.models.annotations.DJIMarker com.dji.mapkit.core.maps.DJIMap.addMarker(com.dji.mapkit.core.models.annotations.DJIMarkerOptions)' on a null object reference

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.