Git Product home page Git Product logo

ttlock / android_sdk_demo Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 22.0 923 KB

TTLock is a global provider of solutions for smart locks. We provide PCBA and softwares for lock manufactures and end users. We provide open API/SDK for developers. With these APIs/SDKs, you can develop your own applications to manage smart locks. The SDK here is for mobile app to communicate with locks via bluetooth.

Java 100.00%
bluetooth-lock smart-lock ttlock ttlock-sdk

android_sdk_demo's People

Contributors

lxk123 avatar ttlock avatar

Stargazers

 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

android_sdk_demo's Issues

Wireless gateway integration issue using new SDK

Hello!

I've used the SDK "ttlock-sdk-2.0.aar" and "ttlock-gateway-sdk-2.0.aar" in my project for the smart locks. Now I want to integrate the wireless gateway into my project. So I tried using GatewayAPI and followed the instruction given in TTLock documentation. It couldn't work for me and I don't know where I'm going wrong. So I tried the new SDK "com.tongtonglock:ttlock:3.0.6" for gateway integration. Using that I could scan the gateway, connect the gateway and scan wifi networks for gateway; but I couldn't init the gateway. I used the credentials of my TTLock account for this. I used the method as below -

        configureGatewayInfo.uid = MY_INTEGER_USER_ID;
        configureGatewayInfo.userPwd = MY_PASSWORD;
        configureGatewayInfo.ssid = binding.wifiName.getText().toString().trim();
        configureGatewayInfo.plugName = binding.gatewayName.getText().toString().trim();
        configureGatewayInfo.wifiPwd = binding.wifiPwd.getText().toString().trim();
        GatewayClient.getDefault().initGateway(configureGatewayInfo, new InitGatewayCallback() {
            @Override
            public void onInitGatewaySuccess(DeviceInfo deviceInfo) {
                makeToast("gateway init success");
            }

            @Override
            public void onFail(GatewayError error) {
                makeToast(error.getDescription());
            }
        });

It is not showing the message in onFail, not in onInitGatewaySuccess and not even showing some error or exception and after some time, the gateway times out.

Can you please tell me where I'm going wrong or help to solve the issue?
Also please let me know if there is any way to integrate "ttlock-sdk-2.0.aar" along with "com.tongtonglock:ttlock:3.0.6".

Thanks in advance!

How can we update sound volume ttlock?

Hi Team,

I verified the documentation and checked it but was not able to identify the below method I also checked the TTLock SDK version is "3.2.6" but not get the below method from this SDK.

I want to update the sound level of my Bluetooth device so how can I do this please help me.

Documentation link
https://euopen.ttlock.com/document/doc?urlName=appSdkV3%2FandroidSdkDemoV3%2FlockApisEn.html

  1. Set sound volume
    public void setLockSoundWithSoundVolume(SoundVolume soundVolume, String lockData, SetLockSoundWithSoundVolumeCallback callback)

  2. Get sound volume
    public void getLockSoundWithSoundVolume(String lockData, GetLockSoundWithSoundVolumeCallback callback)

Note: If possible please give an example so it would be easy to understand

Screenshot_1

ArrayIndexOutOfBounds Exception after ControlLock

Hello everyone,

After using the method controlLock, an exception is thrown that freezes my UI, I dont know how to handle it in order to make my app work. It happens with just few phones.

The error is throwing from the SDK. Here the stacktrace.

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at android.util.SparseArray.keyAt(SparseArray.java:295) at com.ttlock.bl.sdk.api.j.f(Unknown Source:76) at com.ttlock.bl.sdk.api.a$5.run(Unknown Source:1534) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7520) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Thanks in advance,
Francisco.

Lose lockData

Hello, I am Android developer and I should create android application for manage yours locks.
I encountered with problem. I have one lock(M302)
and when I explored his via yours SDK ('com.ttlock:ttlock:3.1.9'), I loose lockData (which got after success called initLock method.)
Now I can't delete him, I can't open/close him. I can't anything. How I can find lockData or remove lock from device without lockData?
Help me please :)
f you need any proofs about it lock belong me, I can give it

Fingerprint Issue

Hi ,

When i Add a new fingerprint im getting an error called "Lock dosen't support this operation"

onScanLockSuccess is not getting called.

Followed all the steps but following method is not getting called.....

Testing on Android version 10....

TTLockClient.getDefault().startScanLock(new ScanLockCallback() {
@OverRide
public void onScanLockSuccess(ExtendedBluetoothDevice device) {
if(mListApapter != null){
mListApapter.updateData(device);
}
}

        @Override
        public void onFail(LockError error) {

            Log.d("TTSCANDLE","FAILED");
            Toast.makeText(ScanLockActivity.this,"FAILED ON BLUETOOTH", Toast.LENGTH_LONG).show();
            Toast.makeText(ScanLockActivity.this,"FAILED ON BLUETOOTH", Toast.LENGTH_LONG).show();
        }
    })

Cannot specify type of the passcode

Cannot create

  • permanent
  • count
  • cycle

passcodes from the new SDK.

createCustomPasscode modifyCustomPasscode and modifyAdminPasscode are the only methods for configuring passcodes. There's no method argument specifying the type of the passcode. I think this is very important and must to have functionality.

The old SDK have them and support them also the TTLock official app. But the old SDK is not longer supported on Android 9 because of the Bluetooth services implemented and permissions.

There is no way to generate one-time passcode

I am trying to create a mobile application in android&ios and i need to create one-time passcode for my lock but i couldn't see that option in the sdk anywhere, Can somebody please let me know how do i create one-time passcode.

Hi guys, I have some doubts about the android sdk. Specifically, the user-register api

I do all the steps that you explain in the documentation for the user registration. I was even guided by your Android_SDK_Demo, but when I do the request to the api sending the data of a new user for register I only get a "200" http response with "Ok" message and the user is never saved. What am I doing wrong or what do I need to add?
The project is already approved and I am using the client_id and secrete_id of the project.

获取、设置音频的开关状态 enabled 值和实际相反

获取音频开关状态 TTLockClient.getDefault().getMuteModeState 方法成功回调 onGetMuteModeStateSuccess(boolean enabled),但是 enabled 值和实际相反,有声音 enabledfalse,没有声音 enabled 值为 true.

同样,设置音频开关状态 TTLockClient.getDefault().setMuteMode 第一个参数 boolean enable 传入 true 实际效果是关闭音频,false 为开启音频。官网文档备注为 enable true – on, false – off,和实际相反?

Implementation for Privacy Lock and Tamper alert Feature

Hi,
I'm currently trying implement privacy lock and tampered alert feature in android app but couldn't find any documentation code to implement which function to use.

Please help me figure out which function to use in TTLOCK sdk

Failed connect to gateway on Android 10

I have tried to scan the gateway successfully when connecting it crashed, but on Android 9 can and smoothly without obstacles

GatewayClient.getDefault().connectGateway(device, object : ConnectCallback {
        override fun onConnectSuccess(device: ExtendedBluetoothDevice?) {
            hideLoading()
            toast("Connected")
            Intent(baseContext, ConfigureNetworkActivity::class.java).apply {
                finish()
                putExtra(ConfigureNetworkActivity.DEVICE_EXTRA, device)
            }.run {
                startActivity(this)
            }
        }

        override fun onDisconnected() {
            hideLoading()
            toast("Disconnected")
        }
    })

I get an error on Android 10: at com.ttlock.bl.sdk.gateway.api.c.d(:79)

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
       at android.util.SparseArray.keyAt(SparseArray.java:295)
       at com.ttlock.bl.sdk.gateway.api.c.d(:79)
       at com.ttlock.bl.sdk.gateway.api.GattCallbackHelper$3.run(:424)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:224)
       at android.app.ActivityThread.main(ActivityThread.java:7520)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

i use sdk ttlock-release-3.0.7
Thanks in advance!

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.