0
我使用Azure的移動服務開發Android應用,
我設置的連接建立成功,
和請確保後臺動作將發送正確的JSON返回。
但是當我打電話Azure的連接成功,我得到正確的JSON結果做CRUD但當時沒有反應,沒有錯誤消息時並停止工作
myUserTable.execute().get();
第一,我得到了我的日誌響應從ServiceFilter
內容 正確的JSON但隨後後停止,沒有任何錯誤消息和異常工作 ...
它只是停止進一步工作...
請參閱下面我的代碼:
的CRUD操作功能:
private void initiate() {
AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>(){
@Override
protected Void doInBackground(Void... params) {
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Link_Azure azure = null;
Log.d("myLog","Start Binding database");
azure = Link_Azure.bindWithMainActivity(MainActivity.this);
List<User> us= azure.loadUserFromTable();
Log.d("myLog","User id : "+us.size());
}catch(MalformedURLException | MobileServiceException | InterruptedException | ExecutionException err){
err.printStackTrace();
}
}
});
} catch (final Exception e) {
e.printStackTrace();
}
return null;
}
};
runAsyncTask(task);
}
事實證明,沒有達到Log.d( 「myLog」, 「用戶ID:」 + us.size ());
功能的啓動Azure的設置
public static Link_Azure bindWithMainActivity(Context main) throws MalformedURLException {
if (azureInstance == null)
azureInstance = new Link_Azure(main);
return azureInstance;
}
private Link_Azure(Context main) throws MalformedURLException {
this.context = main;
mClient = new MobileServiceClient(LINK,context).withFilter(new ProgressFilter());
mClient.setAndroidHttpClientFactory(new OkHttpClientFactory() {
@Override
public OkHttpClient createOkHttpClient() {
OkHttpClient client = new OkHttpClient();
client.setReadTimeout(20, TimeUnit.SECONDS);
client.setWriteTimeout(20, TimeUnit.SECONDS);
return client;
}
});
initiateTables();
}
private void initiateTables(){
mUserManager = mClient.getTable("User",User.class);
mProduct = mClient.getTable("Product",ProductImp.class);
mMail = mClient.getTable("Mail",Mail.class);
mLockerImp = mClient.getTable("Locker",LockerImp.class);
}
的查詢操作
public List<User> loadUserFromTable() throws ExecutionException, InterruptedException, MobileServiceException {
return mUserManager.execute().get();
}
在這裏,在我們的數據庫中所有表:
詳細日誌:
03-08 07:25:46.467 9662-9662/com.example.androidwork.foodsharing W/art: Verification of void com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext.processOperation(com.microsoft.windowsazure.mobileservices.table.sync.operations.TableOperation, com.google.gson.JsonObject) took 218.338ms
03-08 07:25:46.542 9662-9756/com.example.androidwork.foodsharing W/ResourcesManager: Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
03-08 07:25:46.542 9662-9756/com.example.androidwork.foodsharing W/ResourcesManager: Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
03-08 07:25:47.227 9662-9759/com.example.androidwork.foodsharing D/myLog: [{"deleted":false,"updatedAt":"2017-03-06T15:13:47.927Z","createdAt":"2017-03-05T10:52:24.031Z","version":"AAAAAAAAC78=","id":"32C63DBF-F531-4ED9-ABF2-D83919C5F7E7","password":"123","account":"1235","email":null,"phone":null,"live":null,"age":15,"name":"水球潘管理員"}]
如果你做提琴手或郵差請求,它會產生正確的結果嗎?如果您打開詳細級別的診斷日誌記錄,然後使用日誌流,是否會產生任何錯誤? –
是的,它似乎正確的郵遞員,我用它來刪除和查詢與正確的結果,如它顯示在Android ORZ ...我檢查了詳細的日誌,它結束了行內容JSON響應(我已更新我的問題),謝謝。 –